package org.zoomdev.zoom.dao.column;

import org.zoomdev.zoom.common.caster.Base64;
import org.zoomdev.zoom.dao.adapters.DataAdapter;

public final class ByteArray2Base64Adapter implements DataAdapter<byte[], String> {
    @Override
    public String toDbValue(byte[] bytes) {
        if (bytes == null) return null;
        return Base64.encodeToString(bytes);
    }

    @Override
    public byte[] toEntityValue(String s) {
        if (s == null) return null;
        return Base64.decodeFast(s);
    }
}
